﻿'Imports System.Windows.Controls.DataVisualization.Charting

'Public Class HistogramSeries
'  Inherits LineSeries

'  Protected Overrides Sub UpdateDataPoint(dataPoint As DataPoint)
'    ' That set the height and width.
'    MyBase.UpdateDataPoint(dataPoint)
'    ' Now we override the part about setting the width
'    Dim category As Object = dataPoint.ActualIndependentValue
'    Dim coordinateRange = GetCategoryRange(category)
'    Dim minimum As Double = CDbl(coordinateRange.Minimum.Value)
'    Dim maximum As Double = CDbl(coordinateRange.Maximum.Value)
'    Dim coordinateRangeWidth As Double = (maximum - minimum)
'    Const WIDTH_MULTIPLIER As Integer = 1
'    ' Harcoded to 0.8 in the parent. Could make this a dependency property
'    Dim segmentWidth As Double = coordinateRangeWidth * WIDTH_MULTIPLIER
'    Dim columnSeries = SeriesHost.Series.OfType(Of ColumnSeries)().Where(Function(series) series.ActualIndependentAxis = ActualIndependentAxis)
'    Dim numberOfSeries As Integer = columnSeries.Count()
'    Dim columnWidth As Double = segmentWidth / numberOfSeries
'    Dim seriesIndex As Integer = columnSeries.IndexOf(Me)
'    Dim offset As Double = seriesIndex * Math.Round(columnWidth) + coordinateRangeWidth * 0.1
'    Dim dataPointX As Double = minimum + offset
'    Dim left As Double = Math.Round(dataPointX)
'    Dim width As Double = Math.Round(columnWidth)
'    Canvas.SetLeft(dataPoint, left)
'    dataPoint.Width = width
'  End Sub
'#Region "ISeries Members"
'  Private ReadOnly Property ISeries_LegendItems() As System.Collections.ObjectModel.ObservableCollection(Of Object) Implements ISeries.LegendItems
'    Get
'      Return MyBase.LegendItems
'    End Get
'  End Property
'#End Region
'#Region "IRequireSeriesHost Members"
'  Private Property IRequireSeriesHost_SeriesHost() As ISeriesHost Implements IRequireSeriesHost.SeriesHost
'    Get
'      Return MyBase.SeriesHost
'    End Get
'    Set(value As ISeriesHost)
'      MyBase.SeriesHost = value
'    End Set
'  End Property
'#End Region
'End Class
'' Copied from the DataVisualization library
'' (It was an internal class)
'NotInheritable Class MyEnumerableFunctions
'  Private Sub New()
'  End Sub
'  <System.Runtime.CompilerServices.Extension> _
'  Public Shared Function IndexOf(that As IEnumerable, value As Object) As Integer
'    Dim index As Integer = 0
'    For Each item As Object In that
'      If Object.ReferenceEquals(value, item) OrElse value.Equals(item) Then
'        Return index
'      End If
'      index += 1
'    Next
'    Return -1
'  End Function
'End Class